<template>
  <el-table
    :data="tableData"
    border
  >
    <template v-for="(item,index) in tableHeader">
      <table-column
        v-if="item.properties && item.properties.length"
        :key="index"
        :coloumn-header="item"
      ></table-column>
      <el-table-column
        v-else
        :key="index + 'else'"
        :label="item.name"
        :prop="item.code"
        align="center"
        :min-width="item.width ? item.width : '200px'"
      ></el-table-column>
    </template>
  </el-table>
</template>

<script>
import TableColumn from "./TableColumn";
export default {
  props: {
    // 表格的数据
    tableData: {
      type: Array,
      required: true,
    },
    // 多级表头的数据
    tableHeader: {
      type: Array,
      required: true,
    },
    // @Description: 设置表头样式
    headerStyle: {
      type: Object,
      default: () => {
        return {
          background: "#fff",
          fontSize: "14px",
          fontFamily: "AlibabaPuHuiTi_2_85_Bold",
          color: "#222222",
        };
      },
    },
  },
  components: {
    TableColumn,
  },
  methods: {
    load(tree, treeNode, resolve) {
      this.$emit("load", tree, treeNode, resolve);
    },
  },
};
</script>

<style scoped></style>
